<?php
namespace app\web\model;



/**
 * 技师
 * @package app\basic\model
 */
class TechnicianQualifications extends Common 
{
    
    protected function getCheckTimeAttr($v){
        return $v ? date('Y-m-d') : '';
    }
    protected function getCreateTimeAttr($v){
        return $v ? date('Y-m-d') : '';
    }

    public static function add($data,$t_id)
    {
        $ids = [];
        foreach ($data as $key => $value) {
            if(empty($value['job_id']) || empty($value['qualifications_image'])){
                return '请填写完整';
            }
            if(in_array($value['job_id'],$ids)) return '不可选择相同证书';
            $ids[] = $value['job_id'];
            $data[$key]['technician_id'] = $t_id;
        }
        $res = (new self())->saveAll($data);
        return $res ? true : false;
    }
    
}